import { Descriptions } from 'antd';
import Modal from 'antd/lib/modal/Modal';
import React from 'react';
import { CorporateInfo } from '../../../../schema/Corporate';
import '../style.scss';

/**
 * 企业信息详情入参
 */
interface CorporateCheckDetailOption {
  // 对话框可见性
  visible: boolean;
  // 所要展示的数据详情
  corporateInfo?: CorporateInfo;
  // 对话框关闭时的回调
  onClose: () => void;
}

/**
 * 企业信息详情对话框
 */
export const CorporateCheckDetail: React.FC<CorporateCheckDetailOption> = (
  props: CorporateCheckDetailOption
) => {
  const prop = props.corporateInfo as any;

  if (!prop) {
    return <></>;
  }

  return (
    <div>
      <Modal
        width={650}
        className="corporate-check-detail"
        title="企业详情"
        visible={props.visible}
        footer={null}
        onCancel={() => {
          props.onClose();
        }}
      >
        <Descriptions column={2}>
          <Descriptions.Item label="企业名称">{prop.companyName || '--'}</Descriptions.Item>
          <Descriptions.Item label="所属行业">{prop.industryName || '--'}</Descriptions.Item>
          <Descriptions.Item label="联系人姓名">{prop.contactName || '--'}</Descriptions.Item>
          <Descriptions.Item label="手机号">{prop.contactNumber || '--'}</Descriptions.Item>
          <Descriptions.Item label="纳税人识别号">
            {prop.taxpayerIdentityNumber || '--'}
          </Descriptions.Item>
          <Descriptions.Item label="企业账号">{prop.account || '--'}</Descriptions.Item>
          <Descriptions.Item label="最大任务并发">
            {prop.maxTask >= 0 ? prop.maxTask : '--'}
          </Descriptions.Item>
          <Descriptions.Item label="最大呼叫并发">
            {prop.maxCall >= 0 ? prop.maxCall : '--'}
          </Descriptions.Item>
          <Descriptions.Item label="企业地址">{prop.companyAddress || '--'}</Descriptions.Item>
        </Descriptions>
      </Modal>
    </div>
  );
};
